package comportamiento;

import com.uqbar.metalGear.MGSScene;
import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.events.constants.Key;

import componentes.Componente;
import componentes.Coordenada;

public class ControlesPJ {

	private Key leftKey = Key.LEFT;
	private Key rigthKey = Key.RIGHT;
	private Key upKey = Key.UP;
	private Key downKey = Key.DOWN;
	

	public void update(Componente componente, MGSScene scene, DeltaState delta){
		
		if(delta.isKeyBeingHold(upKey)){
			componente.arriba(delta.getDelta());
		}
		if(delta.isKeyBeingHold(downKey)){
			componente.abajo(delta.getDelta());
		}
		if(delta.isKeyBeingHold(leftKey)){
			componente.izquierda(delta.getDelta());
		}
		if(delta.isKeyBeingHold(rigthKey)){
			componente.derecha(delta.getDelta());
		}
		/*
		if(delta.isKeyBeingHold(upKey)){
			componente.arriba(delta.getDelta());
		}
		else{
			if(delta.isKeyBeingHold(downKey)){
				componente.abajo(delta.getDelta());
			}
			else{
				if(delta.isKeyBeingHold(leftKey)){
					componente.izquierda(delta.getDelta());
				}
				else{
					if(delta.isKeyBeingHold(rigthKey)){
						componente.derecha(delta.getDelta());
					}
				}
			}
		}*/
		// para el campo de vision
		
		if(delta.isKeyPressed(Key.V)){
			
			scene.getPj().setCambioColorDeCono(true);
						
		}
		
	}
	
	public void updateCoordenada(Coordenada coordenada, MGSScene scene, DeltaState delta){
		
		if(delta.isKeyBeingHold(upKey)){
			coordenada.arriba(delta.getDelta());
		}
		if(delta.isKeyBeingHold(downKey)){
			coordenada.abajo(delta.getDelta());
		}
		if(delta.isKeyBeingHold(leftKey)){
			coordenada.izquierda(delta.getDelta());
		}
		if(delta.isKeyBeingHold(rigthKey)){
			coordenada.derecha(delta.getDelta());
		}
		
	}
	
}
